using System;
using System.Collections.Generic;
using System.Linq;
using Granite.Commons.Collections;

namespace LeadTracker.Models
{
	public class LeadCommentCollection : ImprovedObservableCollection<LeadCommentModel>
	{
		public LeadCommentCollection() { }

		public LeadCommentCollection(List<LeadCommentModel> list) : base(list) { }
		
		public LeadCommentCollection(IEnumerable<LeadCommentModel> collection) : base(collection) { }

		public LeadCommentCollection(IEnumerable<IDictionary<string, object>> table)
		{
			Add(table);
		}

		public void Add(IEnumerable<IDictionary<string, object>> table)
		{
			foreach (var item in table)
				Add(new LeadCommentModel(item));
		}

		public LeadCommentModel FindKey(int leadCommentKey)
		{
			return this.FirstOrDefault(e => e.LeadCommentKey == leadCommentKey);
		}

	}
}

